home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
graphics
/
mandlbx1.arc
/
FILE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1985-11-20
|
1KB
|
50 lines
#include "\include\define.h"
#include "\include\gemdefs.h"/**/
#include "\include\osbind.h"/**/
#define GRMODE 0 /* graphics mode 0 (320x200) */
#define FSIZE 32034 /* size of DEGAS save-file */
short palette[32];
/* save screen data to disk in DEGAS format */
int write_screen(fname/*,palette*/)
char *fname ;
{
char *scrnp ;
int fd, n ;
short gmode[1] ;
scrnp = (char *)Physbase() ; /* get pointer to display frame */
*gmode = GRMODE ;
if ((fd = creatb(fname, 0755)) < 0) panic("open of '%s' failed\n",fname,0L);
n = w≥ite(fd, gmode, 2) ; /* write graphics mode */
n += write(fd, palette, 32) ; /* write palette */
if ((n += write(fd, scrnp, 32000)) != FSIZE) /* write screen */
panic("file write error: only %d bytes written\n",n,0L);
close(fd) ;
return(0) ;
}
/* read file (DEGAS format) */
int read_screen(fname/*,palette*/)
char *fname ;
/*short *palette ;*/
{
int fd, n ;
short gmode[1] ;
char *scrnp ;
if ((fd = openb(fname, 0)) < 0) panic("open of '%s' failed\n",fname,0L) ;
scrnp = (char *)Physbase() ;
n = read(fd, gmode, 2) ; /* read graphics mode */
n += read(fd, palette, 32) ; /* read palette */
if ((n += read(fd, scrnp, 32000)) != FSIZE) /* read screen */
panic("file write error: only %d bytes read\n",n,0L);
close(fd) ;
return(0) ;
}